# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "dockerfile_examples")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

local_repository(
    name = "io_bazel_rules_docker",
    path = "../..",
)

load(
    "@io_bazel_rules_docker//repositories:repositories.bzl",
    container_repositories = "repositories",
)

container_repositories()

load(
    "@io_bazel_rules_docker//repositories:go_repositories.bzl",
    container_go_deps = "go_deps",
)

container_go_deps()

load("@io_bazel_rules_docker//container:new_pull.bzl", "new_container_pull")
load("@io_bazel_rules_docker//contrib:dockerfile_build.bzl", "dockerfile_image")
load("@io_bazel_rules_docker//java:image.bzl", _java_image_repos = "repositories")

_java_image_repos()

http_archive(
    name = "base_images_docker",
    sha256 = "2c421ca558d043c4da34ddfbee0868c23f10022ee647106dad5f37849e3b0f2f",
    strip_prefix = "base-images-docker-ed6a6f01d92d8ea3ffd01eac3bc9aa009e168c16",
    urls = ["https://github.com/GoogleCloudPlatform/base-images-docker/archive/ed6a6f01d92d8ea3ffd01eac3bc9aa009e168c16.tar.gz"],
)

load("@base_images_docker//package_managers:repositories.bzl", package_manager_deps = "deps")

package_manager_deps()

load("@io_bazel_rules_python//python:pip.bzl", "pip_import", "pip_repositories")

pip_repositories()

pip_import(
    name = "pip_deps",
    requirements = "@base_images_docker//package_managers:requirements-pip.txt",
)

new_container_pull(
    name = "alpine_linux_amd64",
    registry = "index.docker.io",
    repository = "library/alpine",
    tag = "3.8",
)

new_container_pull(
    name = "ubuntu1604",
    registry = "l.gcr.io",
    repository = "google/ubuntu1604",
    tag = "latest",
)

new_container_pull(
    name = "bazel_image",
    registry = "launcher.gcr.io",
    repository = "google/bazel",
)

dockerfile_image(
    name = "basic_alpine_dockerfile",
    dockerfile = "//basic:Dockerfile",
)

dockerfile_image(
    name = "extended_alpine_dockerfile",
    dockerfile = "//extended:Dockerfile",
)

dockerfile_image(
    name = "java_python_dockerfile",
    dockerfile = "//run_instruction_apt_pkgs:Dockerfile",
)

dockerfile_image(
    name = "bazel_gcloud_dockerfile",
    dockerfile = "//run_instruction_arbitrary:Dockerfile",
)

dockerfile_image(
    name = "java_app_dockerfile",
    dockerfile = "//java_app:Dockerfile",
)

http_file(
    name = "gcloud_archive",
    downloaded_file_path = "google-cloud-sdk.tar.gz",
    sha256 = "a2205e35b11136004d52d47774762fbec9145bf0bda74ca506f52b71452c570e",
    urls = [
        "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-220.0.0-linux-x86_64.tar.gz",
    ],
)
